#include "TextureManager.h"
#include "../Generic/DList.h"

enum FONT_STYLE { STYLE_NORMAL = 0, STYLE_WOWMAIL, STYLE_CAMELHUMP, };

#define MAX_STRLEN 128

class FontManager
{
	static FontManager	m_Instance;

	struct Font
	{
		struct Letter
		{
			int		m_OffsetX;
			int		m_OffsetY;
			int		m_Width;
			int		m_Height;
			char	m_Letter;
			char	m_Spacing;
			char	m_Unused[2];
		};

		unsigned int	m_FontTextureID;
		int				m_FontWidth;
		int				m_FontHeight;
		int				m_FontColumnCount;
		int				m_FontRowCount;
		char			m_FontStartingLetter;
		DList<Letter>	m_FontLetters;
	};

	FontManager(void);
	FontManager(const FontManager&);
	FontManager& operator =(const FontManager&);
	~FontManager(void);

	TextureManager*		m_TM;
	DList<Font*>		m_Fonts;
	bool				m_NewLine;
	char				m_String[MAX_STRLEN];

	void HandleStyle(char* string, int style, int index, float& scaleX, float& scaleY);
public:

	static FontManager* GetInstance(void);

	void			Initialize(void);
	unsigned int	LoadFont(const char* fileName, unsigned int style);
	void			Draw(const char* string, unsigned int font, int style, int x, int y, float scaleX, float scaleY);
	void			Shutdown(void);
};